package org.nepu.sc.converter;

import cn.hutool.json.JSONUtil;
import lombok.extern.slf4j.Slf4j;
import org.nepu.sc.domain.DataVO;

import javax.persistence.AttributeConverter;
import javax.persistence.Converter;

@Converter
public class DataVOConverter implements AttributeConverter<DataVO,String> {
    @Override
    public String convertToDatabaseColumn(DataVO dataVO) {
        return JSONUtil.toJsonStr(dataVO);
    }

    @Override
    public DataVO convertToEntityAttribute(String s) {
        return JSONUtil.toBean(s,DataVO.class);
    }
}
